<div th:fragment="atmLeft">
    <div class="left-sidebar">
        <!-- 用户信息 -->
        <div class="tpl-sidebar-user-panel">
            <div class="tpl-user-panel-slide-toggleable">


                <form id="uploadAvatarForm" enctype="multipart/form-data">
                    <div class="am-form-group am-form-file">
                        <div class="tpl-user-panel-profile-picture">
                            <img id="avatarImg" src="/user/showAvatar" alt="">
                        </div>

                        <input id="doc-form-file" type="file" name="avatarFile" multiple="" onchange="uploadAvatar()">
                    </div>
                </form>

                <a href="javascript:;" class="tpl-user-panel-action-link">
                    <span class="am-icon-pencil"></span> 账号设置
                </a>
            </div>
        </div>


        <!-- 菜单 -->
        <ul class="sidebar-nav">

            <li class="sidebar-nav-link">
                <a id="homeA" href="/user/toHome">
                    <i class="am-icon-home sidebar-nav-link-logo"></i> 首页
                </a>
            </li>
            <li class="sidebar-nav-link">
                <a id="openaccountA" href="/user/toOpenAccount">
                    <i class="am-icon-wpforms sidebar-nav-link-logo"></i> 开户
                </a>
            </li>
            <li class="sidebar-nav-link">
                <a href="/user/xxx">
                    <i class="am-icon-wpforms sidebar-nav-link-logo"></i> 取款
                </a>
            </li>
            <li class="sidebar-nav-link">
                <a id="depositA" href="/user/toDeposit">
                    <i class="am-icon-wpforms sidebar-nav-link-logo"></i> 存款

                </a>
            </li>
            <li class="sidebar-nav-link">
                <a id="transferA" href="/user/toTransfer">
                    <i class="am-icon-wpforms sidebar-nav-link-logo"></i> 转账

                </a>
            </li>

            <li class="sidebar-nav-link">
                <a id="flowA" href="/user/toFlow">
                    <i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 流水
                </a>
            </li>

            <li class="sidebar-nav-link">
                <a id="emailA" href="/user/toBindEmail">
                    <i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 绑定邮箱
                </a>
            </li>

            <li class="sidebar-nav-link">
                <a id="rechargeA" href="/user/toRecharge">
                    <i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 充值
                </a>
            </li>

        </ul>
    </div>

    <script>
        function uploadAvatar() {
            $('#uploadAvatarForm').ajaxSubmit({
                url : '/user/uploadAvatar',
                type : 'post',
                success: function (result) {

                    if (result.code != 1000) {
                        alert(result.message);
                        return;
                    }

                    //为了不走缓存，故意将请求参数设置为当前时间毫秒数，这样浏览器每次发现请求地址都是不同的，也就不走缓存了。
                    $('#avatarImg').attr('src', '/user/showAvatar?xxx=' + new Date().getTime());
                }
            })
        }
    </script>
</div>

